<!DOCTYPE html>
<html lang="zh-CN" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <script type="text/javascript">
      function Anima(category) {
        this.category = category;
      }
      Anima.prototype.eat = function () {
        console.log('吃食物');
      }
      function Dog(color) {
        this.color = color;
      }
      Dog.prototype = new Anima('犬');
      Dog.prototype.shout = function () {
        console.log('哼...汪汪汪...可爱的小狗');
      }
      // 天天犬
      function XiaoTianQuan (sex) {
        this.sex = sex;
      }
      XiaoTianQuan.prototype = new Dog('黑色');
      XiaoTianQuan.prototype.fly = function () {
        console.log('天狗吃月');
      }
      var xiaohuang = new XiaoTianQuan('公');
      console.log(xiaohuang.category, xiaohuang.color, xiaohuang.sex);
      xiaohuang.eat();
      xiaohuang.shout();
      xiaohuang.fly();
    </script>
  </body>
</html>
